#pragma once

#include <string>
#include "constant.h"
#include "IPrint.h"
#include <ostream>

using namespace std;

class Transport : public IPrint
{
private:
	
private :
	string id;
	int arrivalTime;
	int capacity;
	int currentLoad;
	int offLoad;
private:
	int enterStationTime ;
	int doneTime;
	int leaveTime;
	int initLoad;
	int unLoaded;
	int loaded;
	bool repaired ;
	bool isRepaired() const { return repaired; }
	bool bShip;
	bool isShip() const { return bShip; }
public :
	void BeShip() { bShip = true; }
	void Repairing() { repaired = true; }
	bool isFull() {return currentLoad == capacity;}
	std::string Id() const { return id; }
	void Id(std::string val) { id = val; }

	int ArrivalTime() const { return arrivalTime; }
	void ArrivalTime(int val) { arrivalTime = val; }
	int Capacity() const { return capacity; }
	void Capacity(int val) { capacity = val; }
	int InitLoad() const { return initLoad; }
	void InitLoad(int val) { initLoad = val; }
	int CurrentLoad() const { return currentLoad; }
	void CurrentLoad(int val) { currentLoad = val; }

	void addLoad(int val)	{ currentLoad += val; }
	void delLoad(int val)	{ currentLoad -= val; }
	int reaminLoad()	{ return capacity - currentLoad; }

	int OffLoad() const { return offLoad; }
	void OffLoad(int val) { offLoad = val; }

	int EnterStationTime() const { return enterStationTime; }
	void EnterStationTime(int val) { enterStationTime = val; }
	int DoneTime() const { return doneTime; }
	void DoneTime(int val) { doneTime = val; }
	int LeaveTime() const { return leaveTime; }
	void LeaveTime(int val) { leaveTime = val; }

	void UnLoad(int val) { unLoaded = val; }
	int UnLoad() { return unLoaded; }
	int Load() const { return loaded; }
	void Load(int val) { loaded = val; }

	void printResult(ostream &out);

	int AdditionalLoad() {	return currentLoad - (initLoad - unLoaded + loaded); }

	int moveInDelay() {	return enterStationTime - arrivalTime; }

	int leaveDelay() {	return leaveTime  - (isRepaired() ? REPAIRDELAY : 0) - doneTime; }

public:
	Transport(string id , int arrivalTime , int maxLoad , int initLoad , int offLoad);
	Transport();
	void preSetting();
	void init(string id , int arrivalTime , int maxLoad , int initLoad , int offLoad);
	~Transport(void);
};
